Skip to content

SAA-4082: Replace prison api locations group endpoint#2020

Merged
Mitchell D'silva (mitchell-dsilva) merged 4 commits intomainfrom
SAA-4082-replace-prisoner-api-locations-group-endpoint
Mar 20, 2026
Merged

SAA-4082: Replace prison api locations group endpoint#2020
Mitchell D'silva (mitchell-dsilva) merged 4 commits intomainfrom
SAA-4082-replace-prisoner-api-locations-group-endpoint

Conversation

@mitchell-dsilva
Copy link
Contributor

@mitchell-dsilva Mitchell D'silva (mitchell-dsilva) commented Mar 19, 2026

Work Done:

  1. The getLocationGroups() method in PrisonApiClient using the deprecated endpoint ("/api/agencies/{agencyId}/locations/groups") from PrisonApi has been removed and a new getLocationGroups() has been added to LocationsInsidePrisonAPIClient for the new endpoint ("/locations/prison/{prisonCode}/groups") in LocationsInsidePrisonApi.
  2. Stub methods have been removed from the PrisonApiMockServer and moved to LocationsInsidePrisonApiMockServer.
  3. Unit and integration tests have been added and amended.

Ticket: SAA-4082

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates “location groups” retrieval off the deprecated Prison API endpoint onto the Locations Inside Prison API, updating the client/service layer and moving corresponding WireMock stubs and fixtures.

Changes:

  • Removed getLocationGroups() from PrisonApiClient and introduced a new getLocationGroups() in LocationsInsidePrisonAPIClient using /locations/prison/{prisonCode}/groups.
  • Replaced the default location-group service implementation from Prison API to Locations Inside Prison API.
  • Updated WireMock servers/fixtures and adjusted unit/integration tests accordingly.

Reviewed changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/kotlin/.../client/prisonapi/api/PrisonApiClient.kt Removes deprecated Prison API location-groups call.
src/main/kotlin/.../client/locationsinsideprison/api/LocationsInsidePrisonAPIClient.kt Adds Locations Inside Prison API location-groups call.
src/main/kotlin/.../service/LocationGroupFromPrisonApiService.kt Removes old default service that called Prison API.
src/main/kotlin/.../service/LocationGroupFromLocationsInsidePrisonApiService.kt Adds new default service that calls Locations Inside Prison API.
src/main/kotlin/.../service/LocationGroupService.kt Renames parameters to prisonCode for clarity/consistency.
src/main/kotlin/.../service/LocationGroupServiceSelector.kt Routes selection using prisonCode terminology.
src/main/kotlin/.../service/LocationGroupFromPropertiesService.kt Updates parameter names, but leaves some agencyId terminology in docs/messages.
src/test/kotlin/.../integration/wiremock/PrisonApiMockServer.kt Removes location-groups stubs from Prison API mock.
src/test/kotlin/.../integration/wiremock/LocationsInsidePrisonApiMockServer.kt Adds location-groups stubs for Locations Inside Prison API mock.
src/test/resources/__files/locationsinsideprisonapi/*.json Adds new WireMock fixtures for location-groups responses/errors.
src/test/kotlin/.../integration/LocationIntegrationTest.kt Updates integration test to stub and assert against Locations Inside Prison API.
src/test/kotlin/.../client/prisonapi/api/PrisonApiClientTest.kt Removes Prison API client tests for deprecated endpoint.
src/test/kotlin/.../client/locationsinsideprison/api/LocationsInsidePrisonAPIClientTest.kt Adds client tests for new location-groups endpoint (currently contains a suspend/assertThrows issue).
src/test/kotlin/.../service/LocationGroupFromLocationsInsidePrisonApiServiceTest.kt Adds service test for new client call (currently contains a suspend verification issue).
Comments suppressed due to low confidence (1)

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsactivitiesmanagementapi/service/LocationGroupFromLocationsInsidePrisonApiServiceTest.kt:52

  • getLocationGroups on LocationsInsidePrisonAPIClient is a suspend function. Using verify(locationsInsidePrisonApiClient).getLocationGroups("LEI") will include the implicit Continuation parameter and typically won't verify correctly. Use Mockito-Kotlin's verifyBlocking { ... } for suspend functions instead (as done elsewhere in the test suite).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 17 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mitchell-dsilva Mitchell D'silva (mitchell-dsilva) merged commit 4d72f31 into main Mar 20, 2026
19 checks passed
@mitchell-dsilva Mitchell D'silva (mitchell-dsilva) deleted the SAA-4082-replace-prisoner-api-locations-group-endpoint branch March 20, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants